home *** CD-ROM | disk | FTP | other *** search
/ Sound Fx / Sound Fx.iso / Software / UNZIPED / DWSTKW / VB / VB4 / PLAY16 / PLAYSTK.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-03-24  |  22.0 KB  |  678 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMain 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    ClientHeight    =   3525
  6.    ClientLeft      =   1770
  7.    ClientTop       =   3255
  8.    ClientWidth     =   7020
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   1
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   3930
  20.    Icon            =   "PLAYSTK.frx":0000
  21.    Left            =   1710
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3525
  24.    ScaleWidth      =   7020
  25.    Top             =   2910
  26.    Width           =   7140
  27.    Begin VB.VScrollBar vsbModifier 
  28.       Height          =   2370
  29.       Index           =   2
  30.       Left            =   5250
  31.       Max             =   16
  32.       Min             =   1
  33.       TabIndex        =   11
  34.       Top             =   615
  35.       Value           =   1
  36.       Width           =   285
  37.    End
  38.    Begin VB.VScrollBar vsbModifier 
  39.       Height          =   2370
  40.       Index           =   1
  41.       Left            =   4635
  42.       Max             =   16
  43.       Min             =   1
  44.       TabIndex        =   10
  45.       Top             =   615
  46.       Value           =   1
  47.       Width           =   285
  48.    End
  49.    Begin VB.CommandButton cmdCommand 
  50.       Appearance      =   0  'Flat
  51.       BackColor       =   &H80000005&
  52.       Caption         =   "&Remove"
  53.       BeginProperty Font 
  54.          name            =   "MS Sans Serif"
  55.          charset         =   1
  56.          weight          =   400
  57.          size            =   8.25
  58.          underline       =   0   'False
  59.          italic          =   0   'False
  60.          strikethrough   =   0   'False
  61.       EndProperty
  62.       Height          =   360
  63.       Index           =   3
  64.       Left            =   3105
  65.       TabIndex        =   9
  66.       Top             =   3060
  67.       Width           =   900
  68.    End
  69.    Begin VB.CommandButton cmdCommand 
  70.       Appearance      =   0  'Flat
  71.       BackColor       =   &H80000005&
  72.       Caption         =   "&Stop"
  73.       BeginProperty Font 
  74.          name            =   "MS Sans Serif"
  75.          charset         =   1
  76.          weight          =   400
  77.          size            =   8.25
  78.          underline       =   0   'False
  79.          italic          =   0   'False
  80.          strikethrough   =   0   'False
  81.       EndProperty
  82.       Height          =   360
  83.       Index           =   2
  84.       Left            =   2100
  85.       TabIndex        =   8
  86.       Top             =   3060
  87.       Width           =   900
  88.    End
  89.    Begin VB.CommandButton cmdCommand 
  90.       Appearance      =   0  'Flat
  91.       BackColor       =   &H80000005&
  92.       Caption         =   "&Play"
  93.       BeginProperty Font 
  94.          name            =   "MS Sans Serif"
  95.          charset         =   1
  96.          weight          =   400
  97.          size            =   8.25
  98.          underline       =   0   'False
  99.          italic          =   0   'False
  100.          strikethrough   =   0   'False
  101.       EndProperty
  102.       Height          =   360
  103.       Index           =   1
  104.       Left            =   1110
  105.       TabIndex        =   7
  106.       Top             =   3060
  107.       Width           =   900
  108.    End
  109.    Begin VB.OptionButton optRate 
  110.       Appearance      =   0  'Flat
  111.       BackColor       =   &H00C0C0C0&
  112.       Caption         =   "44,100kHZ"
  113.       BeginProperty Font 
  114.          name            =   "MS Sans Serif"
  115.          charset         =   1
  116.          weight          =   400
  117.          size            =   8.25
  118.          underline       =   0   'False
  119.          italic          =   0   'False
  120.          strikethrough   =   0   'False
  121.       EndProperty
  122.       ForeColor       =   &H80000008&
  123.       Height          =   225
  124.       Index           =   2
  125.       Left            =   5715
  126.       TabIndex        =   6
  127.       Top             =   2745
  128.       Width           =   1250
  129.    End
  130.    Begin VB.OptionButton optRate 
  131.       Appearance      =   0  'Flat
  132.       BackColor       =   &H00C0C0C0&
  133.       Caption         =   "22,050kHZ"
  134.       BeginProperty Font 
  135.          name            =   "MS Sans Serif"
  136.          charset         =   1
  137.          weight          =   400
  138.          size            =   8.25
  139.          underline       =   0   'False
  140.          italic          =   0   'False
  141.          strikethrough   =   0   'False
  142.       EndProperty
  143.       ForeColor       =   &H80000008&
  144.       Height          =   225
  145.       Index           =   1
  146.       Left            =   5715
  147.       TabIndex        =   5
  148.       Top             =   2445
  149.       Width           =   1250
  150.    End
  151.    Begin VB.CheckBox chkLR 
  152.       Appearance      =   0  'Flat
  153.       BackColor       =   &H00C0C0C0&
  154.       Caption         =   " Left<->Right"
  155.       BeginProperty Font 
  156.          name            =   "MS Sans Serif"
  157.          charset         =   1
  158.          weight          =   400
  159.          size            =   8.25
  160.          underline       =   0   'False
  161.          italic          =   0   'False
  162.          strikethrough   =   0   'False
  163.       EndProperty
  164.       ForeColor       =   &H80000008&
  165.       Height          =   285
  166.       Left            =   5700
  167.       TabIndex        =   4
  168.       Top             =   825
  169.       Width           =   1215
  170.    End
  171.    Begin VB.OptionButton optRate 
  172.       Appearance      =   0  'Flat
  173.       BackColor       =   &H00C0C0C0&
  174.       Caption         =   "11,025kHZ"
  175.       BeginProperty Font 
  176.          name            =   "MS Sans Serif"
  177.          charset         =   1
  178.          weight          =   400
  179.          size            =   8.25
  180.          underline       =   0   'False
  181.          italic          =   0   'False
  182.          strikethrough   =   0   'False
  183.       EndProperty
  184.       ForeColor       =   &H80000008&
  185.       Height          =   225
  186.       Index           =   0
  187.       Left            =   5715
  188.       TabIndex        =   3
  189.       Top             =   2130
  190.       Value           =   -1  'True
  191.       Width           =   1250
  192.    End
  193.    Begin VB.VScrollBar vsbModifier 
  194.       Height          =   2370
  195.       Index           =   0
  196.       Left            =   4200
  197.       Max             =   16
  198.       Min             =   1
  199.       TabIndex        =   2
  200.       Top             =   615
  201.       Value           =   1
  202.       Width           =   285
  203.    End
  204.    Begin VB.CommandButton cmdCommand 
  205.       Appearance      =   0  'Flat
  206.       BackColor       =   &H80000005&
  207.       Caption         =   "&New"
  208.       BeginProperty Font 
  209.          name            =   "MS Sans Serif"
  210.          charset         =   1
  211.          weight          =   400
  212.          size            =   8.25
  213.          underline       =   0   'False
  214.          italic          =   0   'False
  215.          strikethrough   =   0   'False
  216.       EndProperty
  217.       Height          =   360
  218.       Index           =   0
  219.       Left            =   135
  220.       TabIndex        =   1
  221.       Top             =   3060
  222.       Width           =   900
  223.    End
  224.    Begin VB.ListBox lstSounds 
  225.       Appearance      =   0  'Flat
  226.       Height          =   2370
  227.       Left            =   135
  228.       TabIndex        =   0
  229.       Top             =   615
  230.       Width           =   3990
  231.    End
  232.    Begin VB.Label lblLabel 
  233.       Alignment       =   2  'Center
  234.       Appearance      =   0  'Flat
  235.       BackColor       =   &H00C0C0C0&
  236.       Caption         =   "Pitch"
  237.       BeginProperty Font 
  238.          name            =   "MS Sans Serif"
  239.          charset         =   1
  240.          weight          =   400
  241.          size            =   8.25
  242.          underline       =   0   'False
  243.          italic          =   0   'False
  244.          strikethrough   =   0   'False
  245.       EndProperty
  246.       ForeColor       =   &H80000008&
  247.       Height          =   255
  248.       Index           =   4
  249.       Left            =   5130
  250.       TabIndex        =   16
  251.       Top             =   3060
  252.       Width           =   510
  253.    End
  254.    Begin VB.Label lblLabel 
  255.       Alignment       =   2  'Center
  256.       Appearance      =   0  'Flat
  257.       BackColor       =   &H00C0C0C0&
  258.       Caption         =   "Volume"
  259.       BeginProperty Font 
  260.          name            =   "MS Sans Serif"
  261.          charset         =   1
  262.          weight          =   400
  263.          size            =   8.25
  264.          underline       =   0   'False
  265.          italic          =   0   'False
  266.          strikethrough   =   0   'False
  267.       EndProperty
  268.       ForeColor       =   &H80000008&
  269.       Height          =   255
  270.       Index           =   3
  271.       Left            =   4230
  272.       TabIndex        =   15
  273.       Top             =   3060
  274.       Width           =   705
  275.    End
  276.    Begin VB.Label lblLabel 
  277.       Alignment       =   2  'Center
  278.       Appearance      =   0  'Flat
  279.       BackColor       =   &H00C0C0C0&
  280.       Caption         =   "R"
  281.       BeginProperty Font 
  282.          name            =   "MS Sans Serif"
  283.          charset         =   1
  284.          weight          =   400
  285.          size            =   8.25
  286.          underline       =   0   'False
  287.          italic          =   0   'False
  288.          strikethrough   =   0   'False
  289.       EndProperty
  290.       ForeColor       =   &H80000008&
  291.       Height          =   255
  292.       Index           =   2
  293.       Left            =   4650
  294.       TabIndex        =   14
  295.       Top             =   315
  296.       Width           =   255
  297.    End
  298.    Begin VB.Label lblLabel 
  299.       Alignment       =   2  'Center
  300.       Appearance      =   0  'Flat
  301.       BackColor       =   &H00C0C0C0&
  302.       Caption         =   "L"
  303.       BeginProperty Font 
  304.          name            =   "MS Sans Serif"
  305.          charset         =   1
  306.          weight          =   400
  307.          size            =   8.25
  308.          underline       =   0   'False
  309.          italic          =   0   'False
  310.          strikethrough   =   0   'False
  311.       EndProperty
  312.       ForeColor       =   &H80000008&
  313.       Height          =   255
  314.       Index           =   1
  315.       Left            =   4200
  316.       TabIndex        =   13
  317.       Top             =   315
  318.       Width           =   255
  319.    End
  320.    Begin VB.Label lblLabel 
  321.       Appearance      =   0  'Flat
  322.       BackColor       =   &H00C0C0C0&
  323.       Caption         =   "List of Sounds and Music to Play"
  324.       BeginProperty Font 
  325.          name            =   "MS Sans Serif"
  326.          charset         =   1
  327.          weight          =   400
  328.          size            =   8.25
  329.          underline       =   0   'False
  330.          italic          =   0   'False
  331.          strikethrough   =   0   'False
  332.       EndProperty
  333.       ForeColor       =   &H80000008&
  334.       Height          =   255
  335.       Index           =   0
  336.       Left            =   795
  337.       TabIndex        =   12
  338.       Top             =   180
  339.       Width           =   2445
  340.    End
  341.    Begin VB.Image imgIcon 
  342.       Appearance      =   0  'Flat
  343.       Height          =   480
  344.       Left            =   165
  345.       Picture         =   "PLAYSTK.frx":030A
  346.       Top             =   60
  347.       Width           =   480
  348.    End
  349.    Begin MSComDlg.CommonDialog dlgFile 
  350.       Left            =   6480
  351.       Top             =   75
  352.       _version        =   65536
  353.       _extentx        =   847
  354.       _extenty        =   847
  355.       _stockprops     =   0
  356.    End
  357. Attribute VB_Name = "frmMain"
  358. Attribute VB_Creatable = False
  359. Attribute VB_Exposed = False
  360. Option Explicit
  361. Const I_CMD_LOAD = 0
  362. Const I_CMD_PLAY = 1
  363. Const I_CMD_STOP = 2
  364. Const I_CMD_REMOVE = 3
  365. Const I_VSB_LVOL = 0
  366. Const I_VSB_RVOL = 1
  367. Const I_VSB_PITCH = 2
  368. Const I_OPT_11K = 0
  369. Const I_OPT_22K = 1
  370. Const I_OPT_44K = 2
  371. Dim miLastSoundNum As Integer
  372. Dim milDir As Integer
  373. Dim mirDir As Integer
  374. Private Sub chkLR_Click()
  375.     Dim iResult As Integer
  376.     iResult = dws_DClear()
  377.     iResult = dws_MClear()
  378.     iResult = dws_Kill()
  379.     If chkLR.Value = False Then
  380.         t_dws_ID.flags = 0
  381.     Else
  382.         t_dws_ID.flags = dws_ideal_SWAPLR
  383.     End If
  384.     If dws_Init(t_dws_DR, t_dws_ID) = dws_NOSUCCESS Then
  385.         dwsShowError
  386.     End If
  387. End Sub
  388. Private Sub cmdCommand_Click(Index As Integer)
  389.     Dim sString As String
  390.     Dim iIndex As Integer
  391.     Dim iStatus As Integer
  392.     Dim iResult As Integer
  393.     On Error GoTo CCE
  394.     Select Case Index
  395.         Case I_CMD_STOP
  396.             iResult = dws_MClear()
  397.             iResult = dws_DClear()
  398.         
  399.         Case I_CMD_LOAD
  400.             ' Load a default
  401.             dlgFile.FileName = ""
  402.             dlgFile.InitDir = App.Path
  403.             dlgFile.Filter = "Wave, DWD, MIDI Files (*.wav;*.dwd;*.mid)|*.wav;*.dwd;*.mid"
  404.             dlgFile.Action = CD_ACTION_OPEN
  405.             sString = dlgFile.FileName
  406.             If Len(sString) Then
  407.                 If InStr(UCase(sString), ".MID") Then
  408.                     lstSounds.AddItem sString
  409.                     lstSounds.ItemData(lstSounds.ListCount - 1) = -1
  410.                 ElseIf InStr(UCase(sString), ".WAV") Then
  411.                     iIndex = dwsLoadWave(sString)
  412.                     If iIndex > -1 Then
  413.                         lstSounds.AddItem CStr(gtSI(iIndex).Rate) + ", " + sString
  414.                         lstSounds.ItemData(lstSounds.ListCount - 1) = iIndex
  415.                     End If
  416.                 ElseIf InStr(UCase(sString), ".DWD") Then
  417.                     iIndex = dwsLoadWave(sString)
  418.                     If iIndex > -1 Then
  419.                         lstSounds.AddItem CStr(gtSI(iIndex).Rate) + ", " + sString
  420.                         lstSounds.ItemData(lstSounds.ListCount - 1) = iIndex
  421.                     End If
  422.                 End If
  423.                 lstSounds.ListIndex = (lstSounds.ListCount - 1)
  424.                 vsbModifier_Change 0
  425.             End If
  426.             
  427.         Case I_CMD_PLAY
  428.             If lstSounds.ListIndex > -1 Then
  429.                 If lstSounds.ItemData(lstSounds.ListIndex) = -1 Then
  430.                     ' MIDI!
  431.                     Dim tMPlay As dws_MPlay
  432.                     tMPlay.track = lstSounds.List(lstSounds.ListIndex)
  433.                     tMPlay.count = 1
  434.                     iStatus = dws_MPlay(tMPlay)
  435.                         
  436.                     If iStatus = 0 Then
  437.                         dwsShowError
  438.                     End If
  439.                 Else
  440.                     iResult = dwsPlayWave(CInt(lstSounds.ItemData(lstSounds.ListIndex)))
  441.                     miLastSoundNum = gtSI(lstSounds.ItemData(lstSounds.ListIndex)).soundnum
  442.                 End If
  443.             End If
  444.             
  445.         Case I_CMD_REMOVE
  446.             If lstSounds.ListIndex > -1 Then
  447.                 If lstSounds.ItemData(lstSounds.ListIndex) > -1 Then
  448.                     ' A Wave!
  449.                     If Not dwsUnloadWave(CInt(lstSounds.ItemData(lstSounds.ListIndex))) Then
  450.                         MsgBox "Error unloading Wave File!"
  451.                     End If
  452.                 End If
  453.                 
  454.                 lstSounds.RemoveItem lstSounds.ListIndex
  455.             
  456.             End If
  457.             
  458.         Case Else
  459.     End Select
  460. CCER:
  461.     Exit Sub
  462.     MsgBox "Error '" + Error + "' occurred in FRMMAIN:cmdCommand_Click!"
  463.     Resume CCER
  464. End Sub
  465. Private Sub Form_Load()
  466.     ' Center the form!
  467.     Dim sString As String
  468.     Dim lResult As Long
  469.     ReDim gtSI(0) As SoundInfo
  470.     Me.Move (Screen.Width / 2) - (Me.Width / 2), (Screen.Height / 2) - (Me.Height / 2)
  471.     If dws_DetectHardWare(t_dws_DR) = dws_NOSUCCESS Then
  472.         dwsShowError
  473.         End
  474.     End If
  475.     ' No sound card (or something that's weird)
  476.     If t_dws_DR.digcaps = 0 Then
  477.         MsgBox "Your computer does not support sound playback.", 64, "Sound Toolkit Error"
  478.         End
  479.     End If
  480.     ' Does the sound card support the minimum requirements?
  481.     If (t_dws_DR.digcaps And dws_digcap_11025_08_2) = False Then
  482.         sString = "DiamondWare's Sound ToolKit for Windows supports sound playback on your computer.  "
  483.         sString = sString + "However, this demo requires 8-bit stereo "
  484.         sString = sString + "which your computer does not support.  "
  485.         sString = sString + "Your sound hardware does not support "
  486.         sString = sString + "11025Hz, two channel, 8 bit sound "
  487.         sString = sString + "This demo will not run properly on your computer."
  488.         
  489.         MsgBox sString, 64, "Sound Toolkit Error"
  490.         End
  491.     End If
  492.       
  493.     ' Detect and select the best MIDI deivce to use!
  494.     If t_dws_DR.muscaps And dws_muscap_MAPPER Then
  495.         lResult = dws_muscap_MAPPER
  496.     ElseIf t_dws_DR.muscaps And dws_muscap_FMSYNTH Then
  497.         lResult = dws_muscap_FMSYNTH
  498.     ElseIf t_dws_DR.muscaps And dws_muscap_SYNTH Then
  499.         lResult = dws_muscap_SYNTH
  500.     ElseIf t_dws_DR.muscaps And dws_muscap_SQSYNTH Then
  501.         lResult = dws_muscap_SQSYNTH
  502.     ElseIf t_dws_DR.muscaps And dws_muscap_MIDIPORT Then
  503.         lResult = dws_muscap_MIDIPORT
  504.     End If
  505.     ' Set up the 'ideal' music type!
  506.     t_dws_ID.mustyp = lResult
  507.     t_dws_ID.digtyp = dws_digcap_11025_08_2
  508.     t_dws_ID.dignvoices = 6
  509.     If dws_Init(t_dws_DR, t_dws_ID) = dws_NOSUCCESS Then
  510.         dwsShowError
  511.     End If
  512.     vsbModifier(I_VSB_LVOL).Value = 8
  513.     vsbModifier(I_VSB_RVOL).Value = 8
  514.     vsbModifier(I_VSB_PITCH).Value = 8
  515. End Sub
  516. Private Sub Form_Unload(Cancel As Integer)
  517.     Dim iLoop As Integer
  518.     Dim iResult As Integer
  519.     iResult = dws_DClear()
  520.     iResult = dws_MClear()
  521.     ' Unload all loaded wave files!
  522.     If giNumSounds > 0 Then
  523.         For iLoop = 0 To UBound(gtSI)
  524.             iResult = dwsUnloadWave(iLoop)
  525.         Next iLoop
  526.     End If
  527.     If dws_Kill() = dws_NOSUCCESS Then
  528.         dwsShowError
  529.     End If
  530. End Sub
  531. Private Sub lstSounds_DblClick()
  532.     cmdCommand_Click (I_CMD_PLAY)
  533. End Sub
  534. Private Sub optRate_Click(Index As Integer)
  535.     Dim iResult As Integer
  536.     iResult = dws_DClear()
  537.     iResult = dws_MClear()
  538.     iResult = dws_Kill()
  539.     Select Case Index
  540.         Case I_OPT_11K
  541.             t_dws_ID.digtyp = dws_digcap_11025_08_2
  542.         Case I_OPT_22K
  543.             t_dws_ID.digtyp = dws_digcap_22050_08_2
  544.         Case I_OPT_44K
  545.             t_dws_ID.digtyp = dws_digcap_44100_08_2
  546.         Case Else
  547.     End Select
  548.     If dws_Init(t_dws_DR, t_dws_ID) = dws_NOSUCCESS Then
  549.         dwsShowError
  550.     End If
  551. End Sub
  552. Private Sub vsbModifier_Change(Index As Integer)
  553.     Dim iStatus As Integer
  554.     Dim iValue As Integer
  555.     Dim iValue2 As Integer
  556.     Dim iIndex As Integer
  557.     Dim iResult As Integer
  558.     ' Are we changing the volume of a WAVE or MIDI?
  559.     If lstSounds.ListIndex > -1 Then
  560.         If lstSounds.ItemData(lstSounds.ListIndex) = -1 Then
  561.              ' It's a MIDI!
  562.             iValue = ((16 - vsbModifier(I_VSB_LVOL).Value) * 16) - 1
  563.             iValue2 = ((16 - vsbModifier(I_VSB_RVOL).Value) * 16) - 1
  564.             'dws_XMusic iValue, iValue2
  565.             Exit Sub
  566.         End If
  567.     End If
  568.     ' Assign the Sound Num
  569.     If lstSounds.ListIndex = -1 Then
  570.         gPlay.soundnum = 0
  571.     Else
  572.         iIndex = lstSounds.ItemData(lstSounds.ListIndex)
  573.         gPlay.soundnum = gtSI(iIndex).soundnum
  574.     End If
  575.         
  576.     ' Get the current play information associated
  577.     ' with the sound num.
  578.     iResult = dws_DGetInfo(gPlay, ByVal 0&)
  579.         
  580.     ' Adjsut the value
  581.     Select Case Index
  582.         Case I_VSB_PITCH
  583.             iValue = vsbModifier(Index).Value
  584.         Case Else
  585.             iValue = (16 - vsbModifier(Index).Value)
  586.     End Select
  587.     If iValue >= 8 Then
  588.         iValue = (iValue - 7) * 256
  589.     Else
  590.         iValue = iValue * 32
  591.     End If
  592.     Select Case Index
  593.         Case I_VSB_LVOL
  594.             gPlay.flags = dws_dplay_LVOL
  595.             gPlay.lvol = iValue
  596.         
  597.         Case I_VSB_RVOL
  598.             gPlay.flags = dws_dplay_RVOL
  599.             gPlay.rvol = iValue
  600.         
  601.         Case I_VSB_PITCH
  602.             gPlay.flags = dws_dplay_PITCH
  603.             gPlay.pitch = iValue
  604.         
  605.         Case Else
  606.     End Select
  607.     If lstSounds.ListIndex = -1 Then
  608.         gPlay.soundnum = 0
  609.     Else
  610.         gPlay.soundnum = gtSI(iIndex).soundnum
  611.     End If
  612.     ' Assign the new Play Information
  613.     iResult = dws_DSetInfo(gPlay, ByVal 0&)
  614. End Sub
  615. Private Sub vsbModifier_Scroll(Index As Integer)
  616.     Dim iStatus As Integer
  617.     Dim iValue As Integer
  618.     Dim iValue2 As Integer
  619.     Dim iIndex As Integer
  620.     Dim iResult As Integer
  621.     ' Are we changing the volume of a WAVE or MIDI?
  622.     If lstSounds.ListIndex > -1 Then
  623.         If lstSounds.ItemData(lstSounds.ListIndex) = -1 Then
  624.              ' It's a MIDI!
  625.             iValue = ((16 - vsbModifier(I_VSB_LVOL).Value) * 16) - 1
  626.             iValue2 = ((16 - vsbModifier(I_VSB_RVOL).Value) * 16) - 1
  627.             't_dws_XMusic iValue, iValue2
  628.             Exit Sub
  629.         End If
  630.     End If
  631.     ' Assign the Sound Num
  632.     If lstSounds.ListIndex = -1 Then
  633.         gPlay.soundnum = 0
  634.     Else
  635.         iIndex = lstSounds.ItemData(lstSounds.ListIndex)
  636.         gPlay.soundnum = gtSI(iIndex).soundnum
  637.     End If
  638.         
  639.     ' Get the current play information associated
  640.     ' with the sound num.
  641.     iResult = dws_DGetInfo(gPlay, ByVal 0&)
  642.         
  643.     ' Adjsut the value
  644.     Select Case Index
  645.         Case I_VSB_PITCH
  646.             iValue = vsbModifier(Index).Value
  647.         Case Else
  648.             iValue = (16 - vsbModifier(Index).Value)
  649.     End Select
  650.     If iValue >= 8 Then
  651.         iValue = (iValue - 7) * 256
  652.     Else
  653.         iValue = iValue * 32
  654.     End If
  655.     Select Case Index
  656.         Case I_VSB_LVOL
  657.             gPlay.flags = dws_dplay_LVOL
  658.             gPlay.lvol = iValue
  659.         
  660.         Case I_VSB_RVOL
  661.             gPlay.flags = dws_dplay_RVOL
  662.             gPlay.rvol = iValue
  663.         
  664.         Case I_VSB_PITCH
  665.             gPlay.flags = dws_dplay_PITCH
  666.             gPlay.pitch = iValue
  667.         
  668.         Case Else
  669.     End Select
  670.     If lstSounds.ListIndex = -1 Then
  671.         gPlay.soundnum = 0
  672.     Else
  673.         gPlay.soundnum = gtSI(iIndex).soundnum
  674.     End If
  675.     ' Assign the new Play Information
  676.     iResult = dws_DSetInfo(gPlay, ByVal 0&)
  677. End Sub
  678.